home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / tos / gdb / gdb_18s.zoo / st-inflo.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-03-25  |  16.9 KB  |  744 lines

  1. /* this ver hacked up by jrd for atari st */
  2.  
  3. /* Low level interface to ptrace, for GDB when running under Unix.
  4.    Copyright (C) 1986, 1987 Free Software Foundation, Inc.
  5.  
  6. GDB is distributed in the hope that it will be useful, but WITHOUT ANY
  7. WARRANTY.  No author or distributor accepts responsibility to anyone
  8. for the consequences of using it or for whether it serves any
  9. particular purpose or works at all, unless he says so in writing.
  10. Refer to the GDB General Public License for full details.
  11.  
  12. Everyone is granted permission to copy, modify and redistribute GDB,
  13. but only under the conditions described in the GDB General Public
  14. License.  A copy of this license is supposed to have been given to you
  15. along with GDB so you can know your rights and responsibilities.  It
  16. should be in a file named COPYING.  Among other things, the copyright
  17. notice and this notice must be preserved on all copies.
  18.  
  19. In other words, go ahead and share GDB, but don't try to stop
  20. anyone else from sharing it farther.  Help stamp out software hoarding!
  21. */
  22.  
  23. #include "defs.h"
  24. #include "param.h"
  25. #include "frame.h"
  26. #include "inferior.h"
  27.  
  28. #include <stdio.h>
  29. #include <types.h>
  30. #include <file.h>
  31. #include <param.h>
  32. /* #include <dir.h> */
  33. #include <signal.h>
  34. #include <ioctl.h>
  35.  
  36. #define TERMINAL struct sgttyb
  37.  
  38. extern int errno;
  39.  
  40. /* Nonzero if we are debugging an attached outside process
  41.    rather than an inferior.  */
  42.  
  43. static int attach_flag;
  44.  
  45.  
  46. /* Record terminal status separately for debugger and inferior.  */
  47.  
  48. static TERMINAL sg_inferior;
  49. static TERMINAL sg_ours;
  50. static int tflags_inferior;
  51. static int tflags_ours;
  52.  
  53. #ifdef TIOCGLTC
  54. static struct tchars tc_inferior;
  55. static struct tchars tc_ours;
  56. static struct ltchars ltc_inferior;
  57. static struct ltchars ltc_ours;
  58. static int lmode_inferior;
  59. static int lmode_ours;
  60. #endif /* TIOCGLTC */
  61.  
  62. #ifdef TIOCGPGRP
  63. static int pgrp_inferior;
  64. static int pgrp_ours;
  65. #else
  66. static int (*sigint_ours) ();
  67. static int (*sigquit_ours) ();
  68. #endif /* TIOCGPGRP */
  69.  
  70. /* Copy of inferior_io_terminal when inferior was last started.  */
  71. static char *inferior_thisrun_terminal;
  72.  
  73. static void terminal_ours_1 ();
  74.  
  75. /* Nonzero if our terminal settings are in effect.
  76.    Zero if the inferior's settings are in effect.  */
  77. static int terminal_is_ours;
  78.  
  79. /* Initialize the terminal settings we record for the inferior,
  80.    before we actually run the inferior.  */
  81.  
  82. void
  83. terminal_init_inferior ()
  84. {
  85. /*
  86.   if (remote_debugging)
  87.     return;
  88. */
  89.  
  90.   sg_inferior = sg_ours;
  91.   tflags_inferior = tflags_ours;
  92.  
  93. #ifdef TIOCGLTC
  94.   tc_inferior = tc_ours;
  95.   ltc_inferior = ltc_ours;
  96.   lmode_inferior = lmode_ours;
  97. #endif /* TIOCGLTC */
  98.  
  99. #ifdef TIOCGPGRP
  100.   pgrp_inferior = inferior_pid;
  101. #endif /* TIOCGPGRP */
  102.  
  103.   terminal_is_ours = 1;
  104. }
  105.  
  106. /* Put the inferior's terminal settings into effect.
  107.    This is preparation for starting or resuming the inferior.  */
  108.  
  109. void
  110. terminal_inferior ()
  111. {
  112. /*
  113.   if (remote_debugging)
  114.     return;
  115. */
  116.  
  117.   if (terminal_is_ours)   /*  && inferior_thisrun_terminal == 0) */
  118.     {
  119. /* good grief... 
  120.       fcntl (0, F_SETFL, tflags_inferior);
  121.       fcntl (0, F_SETFL, tflags_inferior);
  122.       ioctl (0, TIOCSETN, &sg_inferior);
  123. */
  124.  
  125. #ifdef TIOCGLTC
  126.       ioctl (0, TIOCSETC, &tc_inferior);
  127.       ioctl (0, TIOCSLTC, <c_inferior);
  128. /*       ioctl (0, TIOCLSET, &lmode_inferior); ??? */
  129. #endif /* TIOCGLTC */
  130.  
  131. #ifdef TIOCGPGRP
  132.       ioctl (0, TIOCSPGRP, &pgrp_inferior);
  133. #else
  134.       sigint_ours = (signal (SIGINT, SIG_IGN));
  135.       sigquit_ours = (signal (SIGQUIT, SIG_IGN));
  136. #endif /* TIOCGPGRP */
  137.     }
  138.   terminal_is_ours = 0;
  139. }
  140.  
  141. /* Put some of our terminal settings into effect,
  142.    enough to get proper results from our output,
  143.    but do not change into or out of RAW mode
  144.    so that no input is discarded.
  145.  
  146.    After doing this, either terminal_ours or terminal_inferior
  147.    should be called to get back to a normal state of affairs.  */
  148.  
  149. void
  150. terminal_ours_for_output ()
  151. {
  152. /*
  153.   if (remote_debugging)
  154.     return;
  155. */
  156.  
  157.   terminal_ours_1 (1);
  158. }
  159.  
  160. /* Put our terminal settings into effect.
  161.    First record the inferior's terminal settings
  162.    so they can be restored properly later.  */
  163.  
  164. void
  165. terminal_ours ()
  166. {
  167. /*
  168.   if (remote_debugging)
  169.     return;
  170. */
  171.  
  172.   terminal_ours_1 (0);
  173. }
  174.  
  175. static void
  176. terminal_ours_1 (output_only)
  177.      int output_only;
  178. {
  179. #ifdef TIOCGPGRP
  180.   /* Ignore this signal since it will happen when we try to set the pgrp.  */
  181.   int (*osigttou) ();
  182. #endif /* TIOCGPGRP */
  183.  
  184.   if (!terminal_is_ours)  /*   && inferior_thisrun_terminal == 0)  */
  185.     {
  186.       terminal_is_ours = 1;
  187.  
  188. #ifdef TIOCGPGRP
  189.       osigttou = signal (SIGTTOU, SIG_IGN);
  190.  
  191.       ioctl (0, TIOCGPGRP, &pgrp_inferior);
  192.       ioctl (0, TIOCSPGRP, &pgrp_ours);
  193.  
  194.       signal (SIGTTOU, osigttou);
  195. #else
  196.       signal (SIGINT, sigint_ours);
  197.       signal (SIGQUIT, sigquit_ours);
  198. #endif /* TIOCGPGRP */
  199.  
  200. /*      tflags_inferior = fcntl (0, F_GETFL, 0); ??? */
  201.       ioctl (0, TIOCGETP, &sg_inferior);
  202.  
  203. #ifdef TIOCGLTC
  204.       ioctl (0, TIOCGETC, &tc_inferior);
  205.       ioctl (0, TIOCGLTC, <c_inferior);
  206. /*      ioctl (0, TIOCLGET, &lmode_inferior); ??? */
  207. #endif /* TIOCGLTC */
  208.     }
  209.  
  210. #ifdef HAVE_TERMIO
  211.   sg_ours.c_lflag |= ICANON;
  212.   if (output_only && !(sg_inferior.c_lflag & ICANON))
  213.     sg_ours.c_lflag &= ~ICANON;
  214. #else /* not HAVE_TERMIO */
  215.   sg_ours.sg_flags &= ~RAW & ~CBREAK;
  216.   if (output_only)
  217.     sg_ours.sg_flags |= (RAW | CBREAK) & sg_inferior.sg_flags;
  218. #endif /* not HAVE_TERMIO */
  219.  
  220. /* ???
  221.   fcntl (0, F_SETFL, tflags_ours);
  222.   fcntl (0, F_SETFL, tflags_ours);
  223.   ioctl (0, TIOCSETN, &sg_ours);
  224.  
  225. #ifdef TIOCGLTC
  226.   ioctl (0, TIOCSETC, &tc_ours);
  227.   ioctl (0, TIOCSLTC, <c_ours);
  228.   ioctl (0, TIOCLSET, &lmode_ours);
  229. #endif /* TIOCGLTC */
  230.  
  231. #ifdef HAVE_TERMIO
  232.   sg_ours.c_lflag |= ICANON;
  233. #else /* not HAVE_TERMIO */
  234.   sg_ours.sg_flags &= ~RAW & ~CBREAK;
  235. #endif /* not HAVE_TERMIO */
  236. }
  237.  
  238. static void
  239. term_status_command ()
  240. {
  241.   register int i;
  242.  
  243. /*
  244.   if (remote_debugging)
  245.     {
  246.      printf_filtered ("No terminal status when remote debugging.\n");
  247.       return;
  248.     }
  249. */
  250.  
  251.  printf_filtered ("Inferior's terminal status (currently saved by GDB):\n");
  252.  
  253. #ifdef HAVE_TERMIO
  254.  
  255.  printf_filtered ("fcntl flags = 0x%x, c_iflag = 0x%x, c_oflag = 0x%x,\n",
  256.       tflags_inferior, sg_inferior.c_iflag, sg_inferior.c_oflag);
  257.  printf_filtered ("c_cflag = 0x%x, c_lflag = 0x%x, c_line = 0x%x.\n",
  258.       sg_inferior.c_cflag, sg_inferior.c_lflag, sg_inferior.c_line);
  259.  printf_filtered ("c_cc: ");
  260.   for (i = 0; (i < NCC); i += 1)
  261.    printf_filtered ("0x%x ", sg_inferior.c_cc[i]);
  262.  printf_filtered ("\n");
  263.  
  264. #else /* not HAVE_TERMIO */
  265.  
  266.  printf_filtered ("fcntl flags = 0x%x, lmode = 0x%x,\nsgttyb.sg_flags = 0x%x.\n",
  267.       tflags_inferior, lmode_inferior,
  268.       sg_inferior.sg_flags);
  269.  printf_filtered ("tchars: ");
  270.   for (i = 0; i < sizeof (struct tchars); i++)
  271.    printf_filtered ("0x%x ", ((char *)&tc_inferior)[i]);
  272.  printf_filtered ("\n");
  273.  printf_filtered ("ltchars: ");
  274.   for (i = 0; i < sizeof (struct ltchars); i++)
  275.    printf_filtered ("0x%x ", ((char *)<c_inferior)[i]);
  276.  
  277. #endif /* not HAVE_TERMIO */
  278. }
  279.  
  280. static void
  281. new_tty (ttyname)
  282.      char *ttyname;
  283. {
  284.   register int tty;
  285.   register int fd;
  286.  
  287. #if 0
  288.   /* I think it is better not to do this.  Then C-z on the GDB terminal
  289.      will still stop the program, while C-z on the data terminal
  290.      will be input.  */
  291.  
  292.   /* Disconnect the child process from our controlling terminal.  */
  293.   tty = open("/dev/tty", O_RDWR);
  294.   if (tty > 0)
  295.     {
  296.       ioctl(tty, TIOCNOTTY, 0);
  297.       close(tty);
  298.     }
  299. #endif
  300.   /* Now open the specified new terminal.  */
  301.  
  302.   tty = open(ttyname, O_RDWR);
  303.   if (tty == -1)
  304.     _exit(1);
  305.  
  306. /* who the hell knows...
  307.   dup2(tty, 0);
  308.   dup2(tty, 1);
  309.   dup2(tty, 2);
  310. */
  311.   close(tty);
  312. }
  313.  
  314. /* Start an inferior process and returns its pid.
  315.    ALLARGS is a vector of program-name and args.
  316.    ENV is the environment vector to pass.  */
  317.  
  318. int
  319. create_inferior (allargs, env)
  320.      char **allargs;
  321.      char **env;
  322. {
  323.   int pid;
  324.   extern int sys_nerr;
  325.   extern char *sys_errlist[];
  326.   extern int errno;
  327.  
  328.   /* exec is said to fail if the executable is open.  */
  329.   close_exec_file ();
  330.  
  331. #ifdef eunuchs
  332. /* this cruft left here as reminder of the hard way eunuchs does this. */
  333.   pid = vfork ();
  334.   if (pid < 0)
  335.     perror_with_name ("vfork");
  336.  
  337.   if (pid == 0)
  338.     {
  339. #ifdef TIOCGPGRP
  340.       /* Run inferior in a separate process group.  */
  341. /* ???
  342.       setpgrp (getpid (), getpid ());
  343. */
  344. #endif /* TIOCGPGRP */
  345.  
  346.       inferior_thisrun_terminal = inferior_io_terminal;
  347.       if (inferior_io_terminal != 0)
  348.     new_tty (inferior_io_terminal);
  349.  
  350. /* Not needed on Sun, at least, and loses there
  351.    because it clobbers the superior.  */
  352. /*???      signal (SIGQUIT, SIG_DFL);
  353.       signal (SIGINT, SIG_DFL);  */
  354.  
  355.       ptrace (0);
  356.       execle ("/bin/sh", "sh", "-c", allargs, 0, env);
  357.  
  358.       fprintf_filtered (stderr, "Cannot exec /bin/sh: %s.\n",
  359.            errno < sys_nerr ? sys_errlist[errno] : "unknown error");
  360.       fflush (stderr);
  361.       _exit (0177);
  362.     }
  363. #else
  364. /* atari code here */
  365.   pid = st_execle_kludge(allargs, env);
  366. #endif
  367.   return pid;
  368. }
  369.  
  370. /* Kill the inferior process.  Make us have no inferior.  */
  371.  
  372. static void
  373. kill_command ()
  374. {
  375. /*
  376.   if (remote_debugging)
  377.     return;
  378. */
  379.   if (inferior_pid == 0)
  380.     error ("The program is not being run.");
  381.   if (!query ("Kill the inferior process? "))
  382.     error ("Not confirmed.");
  383.   kill_inferior ();
  384. }
  385.  
  386. kill_inferior ()
  387. {
  388. /*
  389.   if (remote_debugging)
  390.     return;
  391. */
  392.   if (inferior_pid == 0)
  393.     return;
  394. /*  ptrace (8, inferior_pid, 0, 0);
  395.   wait (0); */
  396.   st_child_exit();
  397.   inferior_died ();
  398. }
  399.  
  400. inferior_died ()
  401. {
  402.   inferior_pid = 0;
  403.   attach_flag = 0;
  404.   mark_breakpoints_out ();
  405.   reopen_exec_file ();
  406.   if (have_core_file_p ())
  407.     set_current_frame (read_register (FP_REGNUM));
  408. }
  409.  
  410. /* Resume execution of the inferior process.
  411.    If STEP is nonzero, single-step it.
  412.    If SIGNAL is nonzero, give it that signal.  */
  413.  
  414. void
  415. resume (step, signal)
  416.      int step;
  417.      int signal;
  418. {
  419.   errno = 0;
  420. /*
  421.   if (remote_debugging)
  422.     remote_resume (step, signal);
  423.   else
  424. */
  425.     {
  426. /*
  427.       ptrace (step ? 9 : 7, inferior_pid, 1, signal);
  428.       if (errno)
  429.     perror_with_name ("ptrace");
  430. */
  431.     if (step)
  432.         st_child_single_step();
  433.       else
  434.         st_child_continue();
  435.     }
  436. }
  437.  
  438. #ifdef ATTACH_DETACH
  439.  
  440. /* Start debugging the process whose number is PID.  */
  441.  
  442. attach (pid)
  443.      int pid;
  444. {
  445.   errno = 0;
  446. /* meaningless on st...
  447.   ptrace (PTRACE_ATTACH, pid, 0, 0);
  448.   if (errno)
  449.     perror_with_name ("ptrace");
  450.   attach_flag = 1;
  451. */
  452.   return pid;
  453. }
  454.  
  455. /* Stop debugging the process whose number is PID
  456.    and continue it with signal number SIGNAL.
  457.    SIGNAL = 0 means just continue it.  */
  458.  
  459. void
  460. detach (signal)
  461.      int signal;
  462. {
  463.   errno = 0;
  464. /* ditto...
  465.   ptrace (PTRACE_DETACH, inferior_pid, 1, signal);
  466.   if (errno)
  467.     perror_with_name ("ptrace");
  468. */
  469.   attach_flag = 0;
  470. }
  471. #endif /* ATTACH_DETACH */
  472.  
  473.  
  474. void
  475. fetch_inferior_registers ()
  476. {
  477.   register int regno;
  478.   register unsigned int regaddr;
  479.   char buf[MAX_REGISTER_RAW_SIZE];
  480.   register int i;
  481.  
  482. /* who knows what this is really doing???
  483. #ifdef UMAX_PTRACE
  484.   unsigned int offset = 0;
  485. #else
  486.   struct user u;
  487.   unsigned int offset = (char *) &u.u_ar0 - (char *) &u;
  488.   offset = ptrace (3, inferior_pid, offset, 0) - KERNEL_U_ADDR;
  489. #endif
  490. */
  491.  
  492.   unsigned int offset = 0;
  493.  
  494.   for (regno = 0; regno < NUM_REGS; regno++)
  495.     {
  496.       regaddr = register_addr (regno, offset);
  497.       for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
  498.      {
  499. /*
  500.        *(int *) &buf[i] = ptrace (3, inferior_pid, regaddr, 0);
  501. */
  502.        *(int *) &buf[0] = st_child_read_register(regaddr);
  503.  
  504.        regaddr += sizeof (int);
  505.      }
  506. /* fprintf_filtered(stderr, "supplying register %d from buf %X val %X\n", 
  507.         regno, buf, *(long * )&buf); */
  508.       supply_register (regno, buf);
  509.     }
  510. }
  511.  
  512. /* Store our register values back into the inferior.
  513.    If REGNO is -1, do this for all registers.
  514.    Otherwise, REGNO specifies which register (so we can save time).  */
  515.  
  516. store_inferior_registers (regno)
  517.      int regno;
  518. {
  519.   register unsigned int regaddr;
  520.   char buf[80];
  521.  
  522. /* more blecherosity
  523. #ifdef UMAX_PTRACE
  524.   unsigned int offset = 0;
  525. #else
  526.   struct user u;
  527.   unsigned int offset = (char *) &u.u_ar0 - (char *) &u;
  528.   offset = ptrace (3, inferior_pid, offset, 0) - KERNEL_U_ADDR;
  529. #endif
  530. */
  531.  
  532.   unsigned int offset = 0;
  533.   
  534.   if (regno >= 0)
  535.     {
  536.       regaddr = register_addr (regno, offset);
  537.       errno = 0;
  538. /*
  539.       ptrace (6, inferior_pid, regaddr, read_register (regno));
  540. */
  541.       st_child_write_register(regaddr, read_register (regno));
  542.  
  543.       if (errno != 0)
  544.     {
  545.       printf_filtered (buf, "writing register number %d", regno);
  546.       perror_with_name (buf);
  547.     }
  548.     }
  549.   else for (regno = 0; regno < NUM_REGS; regno++)
  550.     {
  551.       regaddr = register_addr (regno, offset);
  552.       errno = 0;
  553. /*
  554.       ptrace (6, inferior_pid, regaddr, read_register (regno));
  555. */
  556.       st_child_write_register(regaddr, read_register (regno));
  557.  
  558.       if (errno != 0)
  559.     {
  560.       printf_filtered (buf, "writing register number %d", regno);
  561.       perror_with_name (buf);
  562.     }
  563.     }
  564. }
  565.  
  566.  
  567. /* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory
  568.    in the NEW_SUN_PTRACE case.
  569.    It ought to be straightforward.  But it appears that writing did
  570.    not write the data that I specified.  I cannot understand where
  571.    it got the data that it actually did write.  */
  572.  
  573. /* Copy LEN bytes from inferior's memory starting at MEMADDR
  574.    to debugger memory starting at MYADDR.  */
  575.  
  576. read_inferior_memory (memaddr, myaddr, len)
  577.      CORE_ADDR memaddr;
  578.      char *myaddr;
  579.      int len;
  580. {
  581.   register int i;
  582.   /* Round starting address down to longword boundary.  */
  583.   register CORE_ADDR addr = memaddr & - sizeof (int);
  584.   /* Round ending address up; get number of longwords that makes.  */
  585.   register int count
  586.     = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
  587.   /* Allocate buffer of that many longwords.  */
  588.   register int *buffer = (int *) alloca (count * sizeof (int));
  589.  
  590.   /* Read all the longwords */
  591.   for (i = 0; i < count; i++, addr += sizeof (int))
  592.     {
  593. /*      if (remote_debugging)
  594.     buffer[i] = remote_fetch_word (addr);
  595.       else
  596. */
  597. /*
  598.     buffer[i] = ptrace (1, inferior_pid, addr, 0);
  599. */
  600.     buffer[i] = st_child_read_word(addr);
  601.     }
  602.  
  603.   /* Copy appropriate bytes out of the buffer.  */
  604.   bcopy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len);
  605. }
  606.  
  607. /* Copy LEN bytes of data from debugger memory at MYADDR
  608.    to inferior's memory at MEMADDR.
  609.    On failure (cannot write the inferior)
  610.    returns the value of errno.  */
  611.  
  612. int
  613. write_inferior_memory (memaddr, myaddr, len)
  614.      CORE_ADDR memaddr;
  615.      char *myaddr;
  616.      int len;
  617. {
  618.   register int i;
  619.   /* Round starting address down to longword boundary.  */
  620.   register CORE_ADDR addr = memaddr & - sizeof (int);
  621.   /* Round ending address up; get number of longwords that makes.  */
  622.   register int count
  623.     = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
  624.   /* Allocate buffer of that many longwords.  */
  625.   register int *buffer = (int *) alloca (count * sizeof (int));
  626.   extern int errno;
  627.  
  628.   /* Fill start and end extra bytes of buffer with existing memory data.  */
  629.  
  630. /*
  631.   if (remote_debugging)
  632.     buffer[0] = remote_fetch_word (addr);
  633.   else
  634. */
  635. /*
  636.     buffer[0] = ptrace (1, inferior_pid, addr, 0);
  637. */
  638.     buffer[0] = st_child_read_word(addr);
  639.  
  640.   if (count > 1)
  641.     {
  642. /*
  643.       if (remote_debugging)
  644.     buffer[count - 1]
  645.       = remote_fetch_word (addr + (count - 1) * sizeof (int));
  646.       else
  647. */
  648.     buffer[count - 1]
  649. /*
  650.       = ptrace (1, inferior_pid,
  651.             addr + (count - 1) * sizeof (int), 0);
  652. */
  653.       = st_child_read_word(addr + (count - 1) * sizeof (int));
  654.     }
  655.  
  656.   /* Copy data to be written over corresponding part of buffer */
  657.  
  658.   bcopy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
  659.  
  660.   /* Write the entire buffer.  */
  661.  
  662.   for (i = 0; i < count; i++, addr += sizeof (int))
  663.     {
  664.       errno = 0;
  665. /*
  666.       if (remote_debugging)
  667.     remote_store_word (addr, buffer[i]);
  668.       else
  669. */
  670. /*
  671.     ptrace (4, inferior_pid, addr, buffer[i]);
  672. */
  673.     st_child_write_word(addr, buffer[i]);
  674.       if (errno)
  675.     return errno;
  676.     }
  677.  
  678.   return 0;
  679. }
  680.  
  681. /* good grief...
  682. static void
  683. try_writing_regs_command ()
  684. {
  685.   register int i;
  686.   register int value;
  687.   extern int errno;
  688.  
  689.   if (inferior_pid == 0)
  690.     error ("There is no inferior process now.");
  691.  
  692.   for (i = 0; ; i += 2)
  693.     {
  694.       QUIT;
  695.       errno = 0;
  696.       value = ptrace (3, inferior_pid, i, 0);
  697.       ptrace (6, inferior_pid, i, value);
  698.       if (errno == 0)
  699.     {
  700.      printf_filtered (" Succeeded with address 0x%x; value 0x%x (%d).\n",
  701.           i, value, value);
  702.     }
  703.       else if ((i & 0377) == 0)
  704. printf_filtered (" Failed at 0x%x.\n", i);
  705.     }
  706. }
  707. */
  708.  
  709.  
  710. void
  711. initialize_st_inflo ()
  712. {
  713.   add_com ("term-status", class_obscure, term_status_command,
  714.        "Print info on inferior's saved terminal status.");
  715.  
  716. /*
  717.   add_com ("try-writing-regs", class_obscure, try_writing_regs_command,
  718.        "Try writing all locations in inferior's system block.\n\
  719. Report which ones can be written.");
  720. */
  721.  
  722.   add_com ("kill", class_run, kill_command,
  723.        "Kill execution of program being debugged.");
  724.  
  725.   inferior_pid = 0;
  726.  
  727.   ioctl (0, TIOCGETP, &sg_ours);
  728. /*  fcntl (0, F_GETFL, tflags_ours);    ??? */
  729.  
  730. /* ???
  731. #ifdef TIOCGLTC
  732.   ioctl (0, TIOCGETC, &tc_ours);
  733.   ioctl (0, TIOCGLTC, <c_ours);
  734.   ioctl (0, TIOCLGET, &lmode_ours);
  735. #endif /* TIOCGLTC */
  736.  
  737. /* ???
  738. #ifdef TIOCGPGRP
  739.   ioctl (0, TIOCGPGRP, &pgrp_ours);
  740. #endif /* TIOCGPGRP */
  741.  
  742.   terminal_is_ours = 1;
  743. }
  744.